<?php
/**
* Y!地図表示コンポーネントクラスモジュールファイル
*/

require_once dirname(__FILE__) . '/../Components.php';

/**
 * Y!地図表示コンポーネントクラス
 * @author admin
 *
 */
class Components_Ymap_Controller extends Components
{
	const VALUE_RELOAD_FUNC_NAME = 'redrawYMap';

	public $height;
	public $width;
	protected $_sYmapLon;
	protected $_sYmapLat;

	/**
	 * コンストラクタ
	 * @param $sLat 緯度
	 * @param $sLon 経度
	 * @param $sHeight 地図描画の縦
	 * @param $sWidth 地図描画の横幅
	 */
	public function __construct($sCompileId, $sLat='' ,$sLon='', $sHeight=500, $sWidth=800)
	{
		if ($sLat == '') {
			$sLat = '35.66572';
		}
		if ($sLon == ''){
			$sLon = '139.73100';
		}
		parent::__construct(dirname(__FILE__), $sCompileId);
		$this->smarty->compile_id = 'ymap';
		$this->height = $sHeight;
		$this->width = $sWidth;
		$this->_sYmapLat = $sLat;
		$this->_sYmapLon = $sLon;
	}

	/**
	 * FETCH
	 * @see Components_Controller::fetch()
	 */
	public function fetch($sTemplateName="")
	{
		$this->view->height = $this->height;
		$this->view->width = $this->width;
		$this->view->sYmapLat = $this->_sYmapLat;
		$this->view->sYmapLon = $this->_sYmapLon;
		if ( $sTemplateName == "" ) {
			$sTemplateName = 'YMap.tpl';
		}
		$bResult  = parent::fetch($sTemplateName);
		return $bResult;
	}
}